import React from 'react';
import {StyleSheet, View} from 'react-native';
import Toast from 'react-native-easy-toast';

import api from "../../../common/api";

import Header from '../../../components/header';
import Content from './content';

export default class extends React.Component {
    state = {
        qr: 'http://img1.fruitday.com/guan_ewcode1.jpg',
        wechatMobile: '18930202020'
    };

    //获取banner
    getBannerList = () => {
        api({url: 'api/system/getBannerList', notNeedLogin: true})
            .then(data => {
                this.setState({
                    bannerList: data
                });
            })
            .catch(e => {
                console.log(e);
            });
    };

    //toast弹出
    showToast = (text, time = 1000) => {
        this.refs.toast.show(text, time);
    };

    render() {
        const {qr, wechatMobile} = this.state;
        return (
            <View style={styles.container}>
                <Header title="联系客服"/>
                <Content qr={qr} wechatMobile={wechatMobile} showToast={this.showToast}/>
                <Toast ref="toast" position="center"/>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        backgroundColor: '#f0f0f0',
        flex: 1
    }
});
